class UserMessageObserver < ActiveRecord::Observer
  def after_create(user_message)
    #UserNotifier.deliver_signup_notification(user)
    if user_message.box == 'r'
        to_user = User.find(user_message.to_id)
        from_user = User.find(user_message.from_id)
        if to_user.is_email_notify == 1 && from_user.login != "admin"
          UserNotifier.deliver_new_message(to_user, user_message)
        end
    end
  end
end
